<template>
	<form @submit.prevent="register()">
		用户名：<input type="text" name="username" v-model="username"/>
		<br />
		密码：<input type="text" name="userpwd" v-model="userpwd"/>
		<br />
		email：<input type="text" name="useremail" v-model="useremail"/>
		<br />
		头像：<input type="file" id='userfile' name="userfile" v-on:change="userfile()"/>
		<br />
		<input type="submit" />
	</form>
</template>

<script>
	import axios from 'axios'
	export default{
		data(){
			return {
				username: '',
				userpwd: '',
				useremail: '',
			}
		},
		methods:{
			/*action="http://127.0.0.1:8000/axf/register" method="post" @submit.prevent="register()"*/
			userfile(){
				return $('#userfile').val()
			},
			register(){
				const that = this;
				axios.post('/register',{
					'username': that.username,
					'userpwd': that.userpwd,
					'useremail': that.useremail,
					'userfile': that.userfile()
				},)
				 .then(res => {
				 	that.mainlist = res.data
				 })
			}
		}
	}
</script>

<style>
</style>